/*
 * @Author: wukunling 13022195532@163.com
 * @Date: 2024-09-30 09:42:39
 * @LastEditors: wukunling 13022195532@163.com
 * @LastEditTime: 2024-10-01 23:26:19
 * @FilePath: /electron-vue3-template-main/src/main/windows/primary/preload.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { contextBridge, ipcRenderer } from "electron";

/*
暴露primary窗口主进程的方法到primary窗口的渲染进程
*/
contextBridge.exposeInMainWorld("primaryWindowAPI", {
  saveNetServe:(dataList) => {
    console.log('preload.ts','16')
    ipcRenderer.send("savenode-net-serve", dataList)
  },
  sendMessage: (message) => ipcRenderer.send("message", message),
  showFramelessSampleWindow: () => ipcRenderer.send("show-frameless-sample-window"),
  openExternalLink: (url) => ipcRenderer.send("open-external-link", url),
  clearAppConfiguration: () => ipcRenderer.send("clear-app-configuration"),
  onShowExitAppMsgbox: (callback) => ipcRenderer.on("show-exit-app-msgbox", () => {
    callback();
  }),
  onShowClosePrimaryWinMsgbox: (callback) => ipcRenderer.on("show-close-primary-win-msgbox", () => {
    callback();
  }),
  asyncExitApp: () => ipcRenderer.invoke("async-exit-app"),
  minToTray: () => ipcRenderer.send("min-to-tray"),
  httpGetRequest: (url) => ipcRenderer.send("http-get-request", url),
});
